<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%>
<%@ taglib uri="/WEB-INF/c.tld" prefix="c"%>

<%@ page import="java.net.URLEncoder"%>
<%@ page import="com.myspace.domain.Picture"%>
<%@ page import="com.myspace.view.common.Constant"%>
<%@ page import="com.myspace.view.picture.ViewPictureForm"%>

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>我的照片</title>
<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/css/myspace.css" />
<script type="text/JavaScript" src="${pageContext.request.contextPath}/js/myspace.js"></script>
<style type="text/css">
<!--
body {
	background-color: #C9CED2;
	text-align:center;
	margin:0px;
	padding:0px;
}
-->
</style>
</head>

<body>
<div id="wrapper">
  <%@ include file="../inc/headWithNavi.jsp"%>
  <div id="body">
    <div id="content">
      <div id="leftPanel">
        <div class="box">
          <div id="titleRed">${userName} 的空间</div>
          <div id="portrait"> <img src="${pageContext.request.contextPath}/image/none0000.gif" alt="Portrait" width="52" height="52" />
          <a href="#" style="position:absolute; left:115px; top:6px">更改头像</a>
          <a href="#" style="position:absolute; left:115px; top:32px">修改资料</a></div>
          <div align="center"><span class="form_text">昵   称：</span><span class="page">${userName}</span></div>
        </div>
        <div class="box" id="tag">
          <div id="titleGreen">图片标签</div>
          	<c:forEach var="tag" items="${viewPictureForm.tagList}">
				<span>
				<a href="listPicture.do?tagPage=1&tag=<%=URLEncoder.encode((String)pageContext.getAttribute("tag"),"utf-8")%>
					&userId=${viewPictureForm.userId}">
					<c:if test="${tag == viewPictureForm.tag}"><font color="#ff0000">${tag}</font></c:if>
					<c:if test="${tag != viewPictureForm.tag}">${tag}</c:if>
				</a>
				</span>
			</c:forEach>
          <p></p>
        </div>
      </div>
      <div id="photoContainer">
        <div id="titleGreen">
           <span style="float:left;">我的图片</span>
           <span class="menu" style="float:right;" >
	         <c:if test="${pagiTag.hasPrevPage}">
	         <a href="listPicture.do?tagPage=${pagiTag.curPage-1}&tag=${viewPictureForm.encodingTag}
									&userId=${viewPictureForm.userId}">上一页</a> |
			 </c:if>
			 <c:if test="${pagiTag.hasNextPage}">
			 <a href="listPicture.do?tagPage=${pagiTag.curPage+1}&tag=${viewPictureForm.encodingTag}
									&userId=${viewPictureForm.userId}">下一页</a>  |
			 </c:if>
	         <a href="${pageContext.request.contextPath}/picture/viewUpload.do">上传图片</a>
        	</span>
         </div>

         <div style="padding-left:10px;">
			<c:if test="${!empty viewPictureForm.tagPicList}">
<%
				ViewPictureForm form = (ViewPictureForm)request.getAttribute("viewPictureForm");
				int j=0;
				while(j<form.getTagPicList().size()){
					Picture pic = form.getTagPicList().get(j);
					long prePicId = -1;
					long nextPicId = -1;
					if(j>0){
						prePicId = form.getTagPicList().get(j-1).getId();
					}
					if(j<form.getTagPicList().size()-1){
						nextPicId = form.getTagPicList().get(j+1).getId();
					}
					j++;
%>
 					<div onclick="viewPicture('<%=String.valueOf(pic.getId().longValue())%>','${viewPictureForm.encodingTag}',
 					'${viewPictureForm.userId}','<%=prePicId%>','<%=nextPicId%>')" class=" photoPreview"
 					style=" background-image: url(<%= Constant.PIC_HOST_SERVER +  pic.getPreviewPicPath()%>)"></div>
<%
				}
%>
			</c:if>
        </div>
      </div>
	  <span id="copyright">Copyright © 2007-2008 Allen.Chen</span>
    </div>
  </div>

  <div id="footer">
    <div id="left"></div>
    <div id="right"></div>
  </div>
</div>
</body>
</html>
